<?php
/**
 * @brief change_nick protocol
 *
 * @param post uid User ID
 * @param post name User Nick
 * @return True/False
 * @author con100 <con100@playplus.net>
 * @since 05/04/2013
 * @copyright Copyright (c) 2013, PlayPlus
 **/
include 'dbconn.php';

$user_id = mysql_real_escape_string($_POST['uid']);
$new_name = mysql_real_escape_string($_POST['name']);

$sql = "select name from ebs_member where name='$new_name'";
$res = mysql_query($sql);
$num_record = mysql_num_rows($res);
if($num_record != 0){
	$result = array("Result"=>FALSE);
}else{
	$sql = "update ebs_member set name='$new_name' where id='$user_id'";
	$res = mysql_query($sql);
	$result = array("Result"=>TRUE);
}
echo json_encode($result);
/*
header('Content-type: text/xml; charset=UTF-8');

$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(true);
$writer->setIndentString('  ');
$writer->startDocument('1.0', 'UTF-8');

$writer->startElement('change_nick');
	$writer->startElement('result');
	$writer->text($result);
	$writer->endElement();
$writer->endElement();

echo($writer->outputMemory());
*/
?>